package com.yang.abstract_factory;

public class AbstractFactoryTest {

    public static void main(String[] args) {

        //获取车工厂
        AbstractFactory carFactory = FactoryProducer.getFactory("CAR");
        //获取喷漆工厂
        AbstractFactory paintFactory = FactoryProducer.getFactory("PAINT");

        // 获取创建宝马车
        carFactory.getCar("bmw").create();
        // 喷上红色车漆
        paintFactory.getPaint("red").paint();

        // 获取创建保时捷
        carFactory.getCar("porsche").create();
        // 喷上蓝色车漆
        paintFactory.getPaint("blue").paint();

        // 获取创建五菱宏光miniev
        carFactory.getCar("sgmw").create();
        // 喷上黄色车漆
        paintFactory.getPaint("yellow").paint();


    }

}
